package com.shell.arouter.demo.arouter;

import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.durian.base.frame.easyrouter.IntentBuilder;
import com.durian.ui.factory.ViewTools;
import com.henanjianye.soon.communityo2o2.R;
import com.shell.arouter.ui.FragmentCommon;

/**
 * 说明：FragmentUserCenter
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2019-06-27 09:38
 * <p/>
 * 版本：version 1.0
 */
@Route(path = XRouter.User.fragment_user_center)
public class FragmentUserCenter extends FragmentCommon {

    @Autowired IUserService mUserService;
    @Autowired String       name;
    @Autowired int          key;
    private    TextView     tvUsername;

    UserBean mUserBean;

    @Autowired public String src;
    @Autowired public String abc;

    @Override
    protected int getRootViewResID() {
        return R.layout.activity_user_center;
    }

    @Override
    protected void onFirstUserVisible() {
        super.onFirstUserVisible();
        tvUsername = findViewById(R.id.tv_username);
        tvUsername.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IntentBuilder.builder(activity()).with("name", "李四").setResult();
            }
        });

        ViewTools.VISIBLE(tvUsername);
        ViewTools.setText(tvUsername, src);
        mUserBean = mUserService.getUser();
        tvUsername.append(":");
        tvUsername.append(mUserBean.getName());
        tvUsername.append(":abc = ");
        tvUsername.append(abc);
    }

    @Override
    protected void onUserInvisible() {

    }

    @Override
    public boolean isShowTitleBar() {
        return true;
    }

    @Override
    public boolean isShowTitleBarBack() {
        return true;
    }

    @Override
    public String bindTitleBarText() {
        return "用户个人中心";
    }
}
